package com.xzz.cloud.alibaba.controller;

import com.xzz.cloud.alibaba.service.AccountService;
import com.xzz.cloud.entity.CommonResult;
import com.xzz.cloud.entity.Order;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author: hhz
 * @createDate: 2021-4-6
 */
@RestController
public class AccountController {
    @Resource
    private AccountService accountService;
    @PostMapping("/account/decrease")
    public CommonResult decrease(@RequestBody Order order) {
        accountService.decrease(order.getUserId(),order.getMoney());
        return new CommonResult(200,"扣减账户余额成功！");
    }
}
